package com.ztstkj.lzboard.adapters

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.ztstkj.lzboard.R

class HorizontalScrollItemAdapter(private var context:Context,private var datas: List<String>) :RecyclerView.Adapter<HorizontalScrollItemAdapter.ItemViewHolder>(){
    override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int
    ): ItemViewHolder {
        val v = LayoutInflater.from(parent.context)
            .inflate(R.layout.not_civ_item, parent, false)
        return ItemViewHolder(v)
    }

    override fun onBindViewHolder(
        holder: ItemViewHolder,
        position: Int
    ) {
       val url= datas[position]
        Glide.with(context).load(url).into(holder.bannImage)
    }

    override fun getItemCount(): Int {
        return datas.size
    }

    inner class ItemViewHolder(view: View): RecyclerView.ViewHolder(view){
        val bannImage : ImageView = view.findViewById(R.id.banner_image)
    }
}